[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Function strcomma - convert a string to xx,xxx,xxx format
Syntax char *strcomma(char *source);
Prototype in stringhk.h
Remarks strcomma converts a string of numbers into the
comma delimited format (xx,xxx,xxx). The number is
terminated by a non-digit (any character other than
0-9.) A leading sign will be copied before
converting the number.
Return value returns a pointer to the storage location
containing the comma formatted string, or NULL if
space could not be allocated. The returned string
is NOT the same as the string passed to the
function. This function does NOT write over the
string passed to it.
See also strtocomma()
Example #include <stringhk.h>
#include <stdio.h> /* for the printf */
main()
{
char sint[15], *comma;
strcpy(sint,"12839.44");
comma = strcomma(sint);
printf("%s -> %s\n",sint,comma);
}
Program output 12839.44 -> 12,839.44
See Also:
strtocomma()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson